/*
 * Copyright (c) 2009. Silenus Consultoria, S.L.
 */
package es.silenus.detecta.service;

import es.silenus.detecta.dao.Page;

import es.silenus.detecta.model.Organization;

import org.springframework.security.userdetails.GroupManager;

import java.util.List;
import java.util.Map;


/**
 * The organization service.
 *
 * @author <a href="mailto:malonso@silenus-consultoria.es">Mariano Alonso</a>
 * @since 24-jun-2009 12:52:11
 */
public interface OrganizationService extends GroupManager {
	/**
	 * Finds an organization by its identifier.
	 *
	 * @param id the organization id.
	 *
	 * @return the organization.
	 */
	public Organization findOrganizationById(final Integer id);

	/**
	 * Finds every organization.
	 *
	 * @return the organization list.
	 */
	public List<Organization> findAllOrganizations();

	/**
	 * Finds organizations by its name.
	 *
	 * @param name the name.
	 *
	 * @return the organization.
	 */
	public Organization findOrganizationByName(final String name);

	/**
	 * Finds organizations by example.
	 *
	 * @param example the example criteria.
	 *
	 * @return the list of organizations.
	 */
	public List<Organization> findOrganizationsByExample(final Map<String, Object> example);

	/**
	 * Finds organizations by example.
	 *
	 * @param sample the example criteria.
	 * @param start the start.
	 * @param limit the limit.
	 * @param sortFields the sort fields.
	 * @param sortDirections the sort directions.
	 *
	 * @return the page of results.
	 */
	public Page<Organization> findOrganizationsByExample(
		final Map<String, Object> sample, int start, int limit, final String[] sortFields, final String[] sortDirections);

	/**
	 * Creates a new organization.
	 *
	 * @param organization the organization.
	 */
	public void createOrganization(final Organization organization);

	/**
	 * Updates an existing organization.
	 *
	 * @param organization the organization.
	 */
	public void updateOrganization(final Organization organization);

	/**
	 * Retrieves the alfresco URL.
	 *
	 * @param organizationName the organization name (which also is the folder name).
	 *
	 * @return the URL.
	 */
	public String getAlfrescoURL(final String organizationName);
}
